package com.ljw.vendingmachine.bean;

import android.os.Build;

import java.util.Objects;


public class GoodTest implements Cloneable{


    private int goodsId;
    private String goodsTypeName;
    private String gridNo;
    private int gridStatus;
    private int x;//格子X轴坐标
    private int y;//格子y轴坐标
    private int status = -1;

    public int getGoodsId() {
        return goodsId;
    }

    public GoodTest(int goodsId, String gridNo, int x, int y, int status) {
        this.goodsId = goodsId;
        this.gridNo = gridNo;
        this.x = x;
        this.y = y;
        this.status = status;
    }

    public void setGoodsId(int goodsId) {
        this.goodsId = goodsId;
    }

    public String getGoodsTypeName() {
        return goodsTypeName;
    }

    public void setGoodsTypeName(String goodsTypeName) {
        this.goodsTypeName = goodsTypeName;
    }

    public String getGridNo() {
        return gridNo;
    }

    public void setGridNo(String gridNo) {
        this.gridNo = gridNo;
    }

    public int getGridStatus() {
        return gridStatus;
    }

    public void setGridStatus(int gridStatus) {
        this.gridStatus = gridStatus;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public GoodTest(int status) {
        this.status = status;
    }

    public GoodTest() {
    }

    @Override
    public Object clone() {
        GoodTest stu = null;
        try{
            stu = (GoodTest)super.clone();   //浅复制
        }catch(CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return stu;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        GoodTest goods = (GoodTest) o;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            return Objects.equals(goodsId, goods.goodsId);
        }else{
            return goodsId == goods.goodsId ;
        }
    }

    @Override
    public int hashCode() {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            return Objects.hash(goodsId);
        }else{
            return goodsId;
        }
    }

    @Override
    public String toString() {
        return "GoodTest{" +
                "goodsId=" + goodsId +
                ", goodsTypeName='" + goodsTypeName + '\'' +
                ", gridNo='" + gridNo + '\'' +
                ", gridStatus=" + gridStatus +
                ", x=" + x +
                ", y=" + y +
                ", status=" + status +
                '}';
    }
}
